<template>
    <button @click="addCount">{{ btnName }}</button>
</template>

<script>
    export default {
        name: 'countBtn',
        props: {
            btnName: {
                type: String,
                default: '增加按钮'
            }
        },
        data() {
            return {
                count: 0
            }
        },
        methods: {
            addCount() {
                this.count++;
                console.log(this.count);
                this.$emit('changeCount', this.count);
            }
        },
        emits: ['changeCount']
    }
</script>